package dujiu.luogu.sequence;

import java.util.Scanner;

public class P1425 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int d = scanner.nextInt();
        int total = (c*60+d) - (a*60+b);
        int e = total / 60;
        int f = total - e*60;
        System.out.print(e+" "+f);
        scanner.close();
    }
}
